feat(frontend): optional Google sign-in, my-cases library, delete-all and async render - #23
Merged
Merged
Conversation
… and async render
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Frontend half of multitenancy, completing the backend already on main (#21, #22):
lib/auth.ts,AuthMenu.tsx) - gated entirely on all fourVITE_FIREBASE_*build vars being present. When absent (every build today, including CI), the sign-in control renders nothing and the Firebase SDK is never imported, not even as a lazy chunk - confirmed via a production build with nofirebase-*chunk and zeromodulepreloadtags indist/index.html.MyCases.tsx) - lists the signed-in tenant's cases with links to the case/schematic/illustration artifacts, honest empty and 401-degrade states.ConfirmDialog(focus trap, Escape,aria-modal), refreshes to the empty state on success.RenderStep.tsx,queries.ts) - the studio wizard now submits a background job (POST /cases/render/jobs) and polls (GET /cases/render/jobs/{id}) instead of blocking one request for a multi-minute render. Guard rails: ~12 min wall-clock ceiling before an honest "taking longer than expected" state, tolerates up to 3 consecutive transient poll errors without aborting, stops polling on unmount, and handles a job that's alreadydoneon the very first poll (offline/demo path).Auth wiring
lib/api.ts'swithAuth()fetches a fresh ID token per request (never caches the raw JWT) and attachesAuthorization: Bearer <token>only to the six routes whose backend dependency actually reads the tenant (render,submitRenderJob,getRenderJob,manifest,myLibrary,deleteMyData). A signed-out caller omits theheaderskey entirely rather than passing{}, sorequest()'s own defaultAcceptheader survives untouched - byte-identical to the pre-auth guest request.extractandpreviewSchematicnever attach auth at all, even when signed in, since their backend routes don't take a tenant parameter.Test plan
npm run typecheck- cleannpm run test:coverage- 294 tests passing, 97.81%/91.38%/91.21%/97.81% (stmts/branches/funcs/lines), above the 90/90/85/85 gatenpm run build- production build clean, no firebase chunk, no eager modulepreloadnpm run e2e- 17/17 Playwright tests passing (production build), including render-step a11y and the full journey specAuthorizationheader sent guest-side, Firebase never fetchedgit diff --name-only --diff-filter=M -- frontend/srcshows exactly the six genuinely-rewired files (App.tsx,Header.tsx,RenderStep.tsx+test,api.ts,queries.ts) - no unrelated test touchedNew tests:
lib/auth.test.ts(18),lib/api.auth.test.ts(15),lib/queries.auth.test.tsx(6),components/AuthMenu.test.tsx(11),components/ConfirmDialog.test.tsx(16),components/MyCases.test.tsx(15),App.library.test.tsx(2).RenderStep.test.tsxwas rewritten (6 tests) because the render flow itself moved from sync to async - the one legitimate exception to "don't touch unrelated tests."Known dev-mode-only issue (not a regression, does not block this PR)
Under
npm run devwith React StrictMode enabled (the default), the render step's auto-kickoff mutation observer occasionally never surfaces its own settle to the component, even though the job succeeds server-side (confirmed via the query cache). This does not reproduce in the production build, the Playwright e2e suite, or the unit tests, and the identical pattern exists in Cinemory'sGenerateReel.tsx. Filed as a standalone cross-repo investigation, not scoped to this PR.🤖 Generated with Claude Code